home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Developer Helper 1: Phil & Dave's Excellent CD
/
Excellent CD HFS.raw
/
Utilities
/
ResEdit
/
Examples
/
PExamples
/
Source
/
GNRLLDEF.p
next >
Wrap
Text File
|
2022-08-05
|
2KB
|
95 lines
{
COPYRIGHT (C) 1984-1989 Apple Computer,Inc.
All rights reserved
}
{ General LDEF proc }
UNIT GnrlLDEF;
INTERFACE
USES MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf, ResEd;
PROCEDURE DrawCell(Message: INTEGER; lSelect: BOOLEAN; lRect: Rect; lCell: Point; lDataOffset,
lDataLen: INTEGER; lHandle: ListHandle);
IMPLEMENTATION
{$R-}
PROCEDURE DrawCell(Message: INTEGER; lSelect: BOOLEAN; lRect: Rect; lCell: Point; lDataOffset,
lDataLen: INTEGER; lHandle: ListHandle);
VAR
h: Handle;
t: ResType;
id: INTEGER;
st: Str255;
FInfo: FontInfo;
FUNCTION GnrlFetch: Handle;
VAR
id: INTEGER; { Id is stored in the list - could be any type. }
BEGIN
IF lDataLen > sizeof(id) THEN lDataLen := sizeof(id); { Make sure that the length is ok. }
{ Get the id from the list. }
BlockMove(Ptr(ord4(@lHandle^^.cells^^) + lDataOffset), @id, sizeof(id));
SetResLoad(FALSE); { Since all we want is the resinfo }
GnrlFetch := Get1Res(PickHandle(lHandle^^.refCon)^^.rType, id);
SetResLoad(TRUE); { Always leave this set to true. }
END;
PROCEDURE DoHilite;
CONST
HiliteMode = $938;
theHiliteBit = 31;
TYPE
longintPtr = ^longint;
BEGIN
BCLR(longintPtr(HiliteMode)^, theHiliteBit); { Use the proper hilighting for color. }
InvertRect(lRect); { Select the rectangle. }
END;
BEGIN { DrawCell }
CASE Message OF
lInitMsg:
BEGIN { Set the proper indent distance. }
GetFontInfo(FInfo);
WITH FInfo, lHandle^^.indent DO
BEGIN
h := widmax DIV 3;
v := ascent;
END;
END;
lDrawMsg:
IF lDataLen <> 0 THEN
BEGIN
h := GnrlFetch; { Get the resource. }
IF h <> NIL THEN { If we got the resource. }
BEGIN { Build the string for this resource. }
GetResInfo(h, id, t, st);
TypeToString(t, st);
SetETitle(h, st); { Concatenate the id and the name of the resource. }
WITH lRect, lHandle^^.indent DO { Position the pen. }
MoveTo(left + h, top + v);
EraseRect(lRect);
DrawString(st);
IF lSelect THEN { Hilight if necessary. }
DoHilite;
END;
END;
lHiliteMsg: DoHilite;
lCloseMsg: { nothing } ;
END;
END;
END.